Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AES electronic codebook implementation and example #145

Merged
merged 3 commits into from
May 28, 2020

Conversation

thalesfragoso
Copy link
Contributor

Pretty straight forward implementation.

There's just one thing that I want a confirmation, I'm not checking if the data structure is in RAM since neither the method for creating EcbData nor Ecb are const, am I wrong in assuming that EcbData will always be in RAM ?

@thalesfragoso
Copy link
Contributor Author

No fmt on nightly :/

@Yatekii
Copy link
Contributor

Yatekii commented May 16, 2020

There's just one thing that I want a confirmation, I'm not checking if the data structure is in RAM since neither the method for creating EcbData nor Ecb are const, am I wrong in assuming that EcbData will always be in RAM ?

Well, it will always be moved to RAM during runtime anyways, because access in flash surely is slower, no?

@jonas-schievink
Copy link
Contributor

Also see: https://github.com/nrf-rs/nrf51-hal/blob/master/src/ecb.rs

(looks like it was missed by the port)

@thalesfragoso
Copy link
Contributor Author

Well, it will always be moved to RAM during runtime anyways, because access in flash surely is slower, no?

It has to be in RAM because of the EasyDMA, otherwise it can cause hardfaults or memory corruptions.

@jonas-schievink Oh, I didn't know about that. Do you prefer that API ? It seems more straight forward than mine, but with more copying (possibly). Anyway, I should also add a method to change the key.

@jonas-schievink
Copy link
Contributor

The nRF51 API has no persistent memory usage, that part as least seems preferable to me.

@thalesfragoso
Copy link
Contributor Author

The nRF51 API has no persistent memory usage, that part as least seems preferable to me.

I changed the API, let me know what you think.

Copy link
Contributor

@jonas-schievink jonas-schievink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

nrf-hal-common/src/ecb.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@jonas-schievink jonas-schievink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, forgot about this. A few nits, then this should be good to go.

examples/ecb-demo/README.md Outdated Show resolved Hide resolved
# This is exclusive and cannot be used with RTT at the moment.
enabled = false
# The connection string in host:port format wher the GDB server will open a socket.
# gdb_connection_string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it normal to check this file into git?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this file is meant to be checked into git, assuming you/your users use cargo embed :)

51 = ["nrf51-hal"]
52810 = ["nrf52810-hal"]
52832 = ["nrf52832-hal"]
52840 = ["nrf52840-hal"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now have support for the 52833 as well

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also the new HAL needs to reexport this

nrf-hal-common/src/ecb.rs Outdated Show resolved Hide resolved
nrf-hal-common/src/ecb.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@jonas-schievink jonas-schievink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work as always!

@jonas-schievink jonas-schievink merged commit a892cac into nrf-rs:master May 28, 2020
@thalesfragoso thalesfragoso deleted the ecb-impl branch July 19, 2020 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants